<?php
require_once '../Miffos/Library/Html.php';

echo "<h1>Testing class: Html</h1>\n";
/**
 * Experiment with class Html
 */  

/**
 * Create Instance
 */ 
echo "<h2>Create Html element</h2>\n";

$html = Html::el("div","Pepa: ")->class("jupi");
$html->style = array("color"=>"blue");
$html->create("strong","Ahojik")
              ->style = array('color'=>"red");
        
echo $html; 

/**
 * Create multi instance Html
 */ 
echo "\n<h2>Create Multi Html element: create select with option</h2>\n";

$class = true;
$el = Html::el('select')->name('mySelect')->class($class ? 'myclass' : NULL);

    $el->create('option','Ahoj')
        ->value("123")
        ->selected(false);
        
    $el->create('option')
        ->value("456")
        ->selected(true)
        ->setHtml('Hi');
        
echo $el;


/**
 * Create form with Html
 */ 
echo "\n<h2>Create Form with Html</h2>\n";
if($_POST) var_dump($_POST);
$form = Html::el('form')->action('')->method('post');
$form->create('strong','Username:');
$form->create('input')->name('User');
$form->create('br');
$form->create('strong','Password:');
$form->create('input')->type('password')->name('Password');
$form->create('br');
$form->create('input')->type('submit')->value('Prihlas se');
echo $form;

?>